package com.woniuxy.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: 马宇航
 * @Description: TODO
 * @DateTime: 22/10/20/0020 11:36
 * @Component: 成都蜗牛学苑
 **/
@Configuration
public class DirectConfig {
    @Bean
    public Queue directQueue1(){
        return new Queue("directQueue1");
    }
    @Bean
    public Queue directQueue2(){
        return new Queue("directQueue2");
    }
    @Bean
    public DirectExchange directExchange(){
        return new DirectExchange("directExchange");
    }
    @Bean
    public Binding bindingDirect1(){
        //with就是bindingkey；它就是绑定交换机与队列的
        return BindingBuilder.bind(directQueue1()).to(directExchange()).with("orange");
    }
    @Bean
    public Binding bindingDirect2(){
        //with就是bindingkey；它就是绑定交换机与队列的
        return BindingBuilder.bind(directQueue2()).to(directExchange()).with("black");
    }
    @Bean
    public Binding bindingDirect3(){
        //with就是bindingkey；它就是绑定交换机与队列的
        return BindingBuilder.bind(directQueue2()).to(directExchange()).with("green");
    }
}
